/**
 * Copyright (C) 2025 pony working team
 * SPDX-License-Identifier: MulanPSL-2.0
 */

/* includes (local) ----------------------------------------------------------*/
#include <vlog.h>
/* includes (standard library, system) ---------------------------------------*/
/* includes (other library) --------------------------------------------------*/
/* includes (project) --------------------------------------------------------*/

/* defines -------------------------------------------------------------------*/
/* typedefs ------------------------------------------------------------------*/
/* macro ---------------------------------------------------------------------*/
/* variables (extern) --------------------------------------------------------*/
/* variables (local) ---------------------------------------------------------*/

static vlog_t s_vlog_level = VLOG_INFO;

static const char *s_log_names[] = {
    "DEBUG", "INFO", "NOTE", "WARN", "ERR", "CRIT", "ALRT", "EMRG",
};

/* variables (global) --------------------------------------------------------*/
/* inlines -------------------------------------------------------------------*/
/* functions -----------------------------------------------------------------*/

void vlog_set_level(vlog_t level)
{
    s_vlog_level = level;
}

vlog_t vlog_get_level(void)
{
    return s_vlog_level;
}

const char *vlog_get_name(vlog_t level)
{
    if (level >= VLOG_MAX) {
        return "UNKOWN";
    }

    return s_log_names[level];
}
